package com.example.dormitoryscoresystem.controller;


import com.example.dormitoryscoresystem.service.ScoreService;
import lombok.Data;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;
@Data
@RestController
@RequestMapping("/api/score")
@CrossOrigin
public class ScoreController {

    @Autowired
    private ScoreService scoreService;

    @PostMapping("/submit")
    public String submit(@RequestBody ScoreRequest request) {
        scoreService.submitScore(request.getDormId(), request.getScore(), request.getRemarks());
        return "Score submitted successfully";
    }

    @Data
    public static class ScoreRequest {
        private String dormId;
        private int score;
        private String remarks;
    }
}
